# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/23 下午3:28
 @Author  : tgy
 
"""

def test01():
    ...
    global x
    x = 10


def test02():
    ...
    x = 20
    def test03():
        # nonlocal 后面的变量必须在外面的函数中定义赋值，才能使用
        nonlocal x
        x = 100
    test03()
    print(x)


def test():
    l = [(1, 2), (3, 4)]
    # for tt in globals().keys():
    #     ...
    #     print(globals())
    for k1, k2 in l:
        print('k1:{},k2{}'.format(k1, k2))
        print(globals())

if __name__ == '__main__':
    ...
    # test01()
    test02()
